{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 测试成功"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'ImageDraw' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-2-757f927e2a3e>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      3\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpyplot\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mplt\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      4\u001b[0m \u001b[0mim\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mImage\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mnew\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"I\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;36m512\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m512\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m1000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 5\u001b[1;33m \u001b[0mdraw\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mImageDraw\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mDraw\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mim\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mmode\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'RGB'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      6\u001b[0m \u001b[0mdraw\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrectangle\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m100\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m200\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m300\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m400\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m100\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m100\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      7\u001b[0m \u001b[0mfig\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0max\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mplt\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msubplots\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mNameError\u001b[0m: name 'ImageDraw' is not defined"
     ]
    }
   ],
   "source": [
    "%matplotlib qt5\n",
    "from PIL import Image\n",
    "import matplotlib.pyplot as plt\n",
    "im = Image.new(\"I\", (512, 512), 1000)\n",
    "draw = ImageDraw.Draw(im,mode='RGB')\n",
    "draw.rectangle((100, 200, 300, 400), 100, 100)\n",
    "fig,ax=plt.subplots()\n",
    "plt.imshow(im)\n",
    "plt.show()\n",
    "im.getpixel((150,283)) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3\n"
     ]
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "from PIL import Image\n",
    "from PIL import ImageDraw\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "H=np.array([1,2,1,4])\n",
    "print(np.argmax(H))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAARUAAAD8CAYAAABZ0jAcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAD05JREFUeJzt3V2MHeV9x/HvPyagiBDVBNciLghbMiATtZuwopECKBVN\nMFYVh15Qc0GdFtUgKApqqsqEi6JKSGkaglRFEJmC4lYE4pTQ+IK+GCtKVKm8GOQYbDDYYAQrYwOR\nStRGTvD+ezHPqYdl19495/Huefl+pNXOeWbm7IxW56czM2fOLzITSarlQwu9AZKGi6EiqSpDRVJV\nhoqkqgwVSVUZKpKqmvdQiYjVEbE3IvZFxMb5/vuSTq6Yz8+pRMQi4CXg88AbwNPAtZm5Z942QtJJ\nNd/vVC4B9mXmK5n5K+BhYO08b4Okk+iUef57y4DXW4/fAH536kIRsQHYAHD66adffOGFF87P1kkj\n6MCBA7z99ttR6/nmO1RmJTM3AZsAxsfHc8eOHQu8RdLwGh8fr/p88334MwGc03r8W2XshD70IS9U\nSYNgvl+pTwMrI2J5RJwKrAO2zmbFyclJg0UaAPN6+JOZ70XEnwP/DiwCHsjM3bNdvxMsk5OTJ20b\nJfVm3s+pZOZjwGPdrm+wSP1tII8nPBSS+tfAvjINFqk/DfSr0mCR+s/AvyINFqm/DMWr0WCR+sfQ\nvBINFqk/DNWr0GCRFt7QvQINFmlhDeWrz2CRFs7QvvIMFmlhDPWrzo/yS/NvqENF0vwzVCRVZahI\nqspQkVSVoSKpKkNFUlWGiqSqug6ViDgnIn4cEXsiYndEfKWM3xERExGxs/ysaa1zW6k73RsRV9bY\nAUn9pZfvqH0P+GpmPhsRZwDPRMS2Mu/uzPxme+GIWEXz7fkXAZ8AHo+I8zPzaA/bIKnPdP1OJTMP\nZuazZfoXwAs0DYQzWQs8nJlHMvNVYB9NDaqkIVLlnEpEnAd8CniyDN0SEbsi4oGIWFzGpqs8PV4I\nSRpAPYdKRHwUeAS4NTPfBe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HPk7zhVYvA48DZ7bWub3s614W+OrBNPvzEM2hQOfrK67vZl+AcZoX6X7g25RPdPfZfv0T8Byw\nq7zYzh7A/bqU5tBmF7Cz/KyZr/+ZH9OXVFW/Hv5IGlCGiqSqDBVJVRkqkqoyVCRVZahIqspQkVTV\n/wFn2qg7H3JIcQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1fc02b0b2b0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "im = Image.new(\"I\", (2000, 2000),255)\n",
    "draw = ImageDraw.Draw(im,mode='I')\n",
    "# draw.ellipse((1500,1000,1600,1100),0, 0) \n",
    "# draw.ellipse((400,700,600,900),0, 0) \n",
    "# draw.ellipse((200,300,500,600),0, 0) \n",
    "# draw.ellipse((1500,500,1800,800),0, 0) \n",
    "# draw.ellipse((1200,1400,1600,1800),0, 0) \n",
    "# draw.ellipse((700,1200,960,1460),0, 0) \n",
    "# draw.ellipse((300,1600,500,1800),0, 0) \n",
    "# draw.ellipse((100,1100,300,1300),0, 0) \n",
    "# draw.ellipse((1100,250,1300,450),0, 0) \n",
    "# draw.ellipse((1150,850,1300,1000),0, 0) \n",
    "# draw.ellipse((900,550,1050,700),0, 0)\n",
    "# draw.ellipse((650,100,850,300),0, 0) \n",
    "# draw.ellipse((1700,130,1900,330),0, 0)\n",
    "# draw.ellipse((800,900,1000,1100),150, 150) #圆心为（900，1000）\n",
    "draw.line((20, 20, 150, 150))\n",
    "# def Scan(Scan_Cur_X,Scan_Cur_Y,Angle):\n",
    "#     Obs_x_line=[]\n",
    "#     Obs_y_line=[]\n",
    "#     Dis_Level=0\n",
    "#     Obs_Dis=0\n",
    "#     Obs_Dis_X=Obs_Dis*np.sin(Angle/180*np.pi)\n",
    "#     Obs_Dis_Y=Obs_Dis*np.cos(Angle/180*np.pi)\n",
    "#     while(im.getpixel((Obs_Dis_X,Obs_Dis_Y)) is not 0 and Obs_Dis!=1000):\n",
    "#         Obs_Dis+=5\n",
    "#         Obs_Dis_X=Obs_Dis*np.sin(Angle/180*np.pi)\n",
    "#         Obs_Dis_Y=Obs_Dis*np.cos(Angle/180*np.pi)\n",
    "#     if 0<=Obs_Dis<50:\n",
    "#         Dis_Level=0\n",
    "#     elif 50<=Obs_Dis<250:\n",
    "#         Dis_Level=0\n",
    "          \n",
    "#     return Obs_Dis\n",
    "fig,ax=plt.subplots()\n",
    "plt.imshow(im)\n",
    "plt.show()\n",
    "# plt.clf()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "345.0\n",
      "(15.0, 'right', 141.42135623730951)\n"
     ]
    }
   ],
   "source": [
    "def Robot_desti_(desti_x_,desti_y_,robot_x_,robot_y_,robot_a):\n",
    "    #Left-negative,180-360 |||| Right-positive,0-180\n",
    "    delta_x=desti_x_-robot_x_\n",
    "    delta_y=desti_y_-robot_y_\n",
    "    distance=np.sqrt(delta_x*delta_x+delta_y*delta_y)\n",
    "#     print(delta_x)\n",
    "#     print(delta_y)\n",
    "#     print((np.arctan(delta_y/delta_x))*180/np.pi)\n",
    "    direct_angle=(np.arctan(delta_y/delta_x))*180/np.pi\n",
    "    true_angle=(robot_a-direct_angle)%360\n",
    "    print(true_angle)\n",
    "    if true_angle>180:\n",
    "        return 360-true_angle,'right',distance\n",
    "    else:\n",
    "        return true_angle,'left',distance\n",
    "print(Robot_desti_(300,100,200,200,-60))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[4]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "a=np.arange(0,10).reshape(2,-1)\n",
    "print(a)\n",
    "np.savetxt(\"a.txt\",a) #缺省按照'%.18e'格式保存数据，以空格分隔\n",
    "H=np.loadtxt(\"a.txt\")\n",
    "print(H[1])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "f = open('a.txt', 'w')\n",
    "f.write('hello,')\n",
    "f.write('iplaypython')\n",
    "f.close()\n",
    "import numpy as np\n",
    "a=np.arange(0,10).reshape(2,-1)\n",
    "print(a)\n",
    "np.savetxt(\"a.txt\",a) #缺省按照'%.18e'格式保存数据，以空格分隔\n",
    "H=np.loadtxt(\"a.txt\")\n",
    "print(H[1])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "\n",
    "import numpy as np\n",
    "from PIL import Image\n",
    "from PIL import ImageDraw\n",
    "from PIL import ImageFont\n",
    " \n",
    " \n",
    "def draw_test():\n",
    " \n",
    "    #生成深蓝色绘图画布\n",
    "    array = np.ndarray((480, 640, 3), np.uint8)\n",
    " \n",
    "    array[:, :, 0] = 0\n",
    "    array[:, :, 1] = 0\n",
    "    array[:, :, 2] = 100\n",
    " \n",
    "    image = Image.fromarray(array)\n",
    " \n",
    "    #创建绘制对象\n",
    "    draw = ImageDraw.Draw(image,mode='l')\n",
    "    \n",
    "    #绘制直线\n",
    "    draw.line((20, 20, 150, 150), 'cyan')\n",
    " \n",
    "    #绘制矩形\n",
    "    draw.rectangle((100, 200, 300, 400), 'black', 'red')\n",
    " \n",
    "    #绘制弧\n",
    "    draw.arc((100, 200, 300, 400), 0, 180, 'yellow')\n",
    "    draw.arc((100, 200, 300, 400), -90, 0, 'green')\n",
    " \n",
    "    #绘制弦\n",
    "    draw.chord((350, 50, 500, 200), 0, 120, 'khaki', 'orange')\n",
    " \n",
    "    #绘制圆饼图\n",
    "    draw.pieslice((350, 50, 500, 200), -150, -30, 'pink', 'crimson')\n",
    "    \n",
    "    #绘制椭圆\n",
    "    draw.ellipse((350, 300, 500, 400), 'yellowgreen', 'wheat')\n",
    "    #外切矩形为正方形时椭圆即为圆\n",
    "    draw.ellipse((550, 50, 600, 100), 'seagreen', 'skyblue') \n",
    " \n",
    "    #绘制多边形\n",
    "    draw.polygon((150, 180, 200, 180, 250, 120, 230, 90, 130, 100), 'olive', 'hotpink')\n",
    " \n",
    "    #绘制文本\n",
    "    font = ImageFont.truetype(\"consola.ttf\", 40, encoding=\"unic\")#设置字体\n",
    "    draw.text((100, 50), u'Hello World', 'fuchsia', font)\n",
    " \n",
    "    image.show()\n",
    "    return\n",
    "draw_test()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
